package com.sunni.generator.system.controller;


import com.sunni.generator.system.entity.NavigationConfig;
import com.sunni.generator.system.service.HelloService;
import lombok.RequiredArgsConstructor;
import org.apache.ibatis.reflection.ArrayUtil;
import org.apache.tomcat.util.codec.binary.Base64;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

import static java.util.Comparator.comparingLong;
import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.toCollection;

/**
 * <p>
 * 导航栏配置表 前端控制器
 * </p>
 *
 * @author jl
 * @since 2022-02-22
 */
@RestController
@RequestMapping("/system")
@RequiredArgsConstructor
public class NavigationConfigController {
    private final Map<String, HelloService> map;

    @GetMapping("/{type}")
    public void config(@PathVariable String type) {
        HelloService helloService = map.get("hello" + type);
        helloService.say();
    }

    public static void main(String[] args) {
//        String clientCredentials = String.format("%s:%s", "W1053Z", "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCXlDWI8st+w7C+AURu2so5rRpXDzTf0hST65QlmB2Ba2Y9YG/x7erN3VLZg/5OxZnoRxBLvt+wP2SiwTC4YWWjDPzGHcT0L61+DbnqNvL+KMQtxKlY1icx+FU4XyEZ0iDyRYEpQn2T3qU5s+4HBkHQ4zwafZ91bt17UqQTqep9BwIDAQAB");
        String clientCredentials = String.format("%s:%s", "SP2000490_Dev", "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCzN7zlIOvmdfppkYTR6EGaoVueTcrnrSRPntY+z+NxNYXsRofLPMzwKb0UIpoM43LB2sbz4zcKg4SX7yRUyKrZnIAOr9D0047Ub5Uv3eTYEWz6zkdSJQtMldUnxYqH3GjCOhrLt0pvX/vW5Q/GEG3jA+V5VkRCnOqb9+wxMuI/iwIDAQAB");
        String base64ClientCredentials = new String(Base64.encodeBase64(clientCredentials.getBytes()));
        System.out.println("Basic " + base64ClientCredentials);
    }

}
